﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TongHopBookFlightDAO.DAO
{
    public class HangHangKhongDAO
    {
        /// <summary>
        /// Lấy hãng hàng không dựa vào tên hãng 
        /// </summary>
        /// <param name="tenHang">tên hãng hàng không</param>
        public static HangHangKhong SelectByName(string tenHang)
        {
            HangHangKhong hangHangKhong = null;
            try
            {
                BookFlightDataContext context = new BookFlightDataContext();
                hangHangKhong = context.HangHangKhongs.Where(p => p.TenHang.Trim() == tenHang.Trim()).FirstOrDefault();
               
            }
            catch { }
            return hangHangKhong;
        }

        public static HangHangKhong SelectByFlightID(int hangHangKhongID)
        {
            HangHangKhong hangHangKhong = null;
            try
            {
                BookFlightDataContext context = new BookFlightDataContext();
                hangHangKhong = context.HangHangKhongs.Where(p => p.HangHangKhongID == hangHangKhongID).FirstOrDefault();

            }
            catch { }
            return hangHangKhong;
        }
    }
}
